<?php
include_once("../config/module_product_config.php");
include_once("../includes/tag_inc.php");
//========================
if(isset($_POST["action"]))
{
	$_POST['rank']*=1;
	$_POST['market_price']*=1;
	$_POST['price']*=1;
	
	$sql="update ".PRO." set 
	pname='$_POST[pname]',con='$_POST[con]',gg='$_POST[gg]',pp='$_POST[pp]',price='$_POST[price]',
	con='$_POST[con]',trade_type='$_POST[trade_type]',rank='$_POST[rank]',market_price='$_POST[market_price]'
	where id='$_POST[id]'";
	$db->query($sql);
	
	$sql="UPDATE ".PRODETAIL."  set detail='$_POST[prodetail]' WHERE proid=$_POST[id]";
	$db->query($sql);
	
	edit_tags($_POST['keyword'],1,$_POST['id']);
	
	unset($_GET['id']);
	$_GET['s']='prolist.php';
	msg("module.php?".implode('&',convert($_GET)));
}
//===================
$db->query("select * from ".PRO." where id='$_GET[id]' ");
while($db->next_record())
{
	$id=$db->f('id');
	$userid=$db->f('userid');
	$pname=$db->f('pname');
	$con=$db->f('con');
	$gg=$db->f('gg');
	$units=$db->f('unit');
	$pp=$db->f('pp');
	$price=$db->f('price');
	$market_price=$db->f('market_price');
	$statu=$db->f('statu');
	$rank=$db->f('rank');
	$keyword=get_tags($id,1);
	$types=$db->f('trade_type');
}
$db->query("select * from ".PRODETAIL." where proid='$_GET[id]'");
$re=$db->fetchRow();
$detail=$re['detail'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE><?php echo lang_show('admin_system');?></TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="main.css" rel="stylesheet" type="text/css" />
</HEAD>
<body>
<div class="bigbox">
	<div class="bigboxhead"><?php echo lang_show('product_mod');?></div>
	<div class="bigboxbody">
        <form name="form1" method="post" action="" enctype="multipart/form-data">
          <table width="100%" border="0" cellpadding="4" cellspacing="0">
            <tr> 
              <td width="147" align="left"><?php echo lang_show('product_name');?></td>
              <td> 
                <input class="text" name="pname" type="text" id="goods" value="<?php echo "$pname";?>" size="30">
                <input name="id" type="hidden" id="id" value="<?php echo "$id";?>">
			  </td>
            </tr>
			<tr  class="menu"> 
              <td align="left" ><?php echo lang_show('brand');?></td>
              <td width="823"> <input class="text" name="pp" type="text" value="<?php echo "$pp"; ?>" size="30"></td>
            </tr>
            <tr  class="menu"> 
              <td align="left"><?php echo lang_show('specifications');?></td>
              <td width="823"><input class="text" name="gg" type="text" value="<?php echo "$gg"; ?>" size="30"></td>
            </tr>
			<?php include_once("../lang/".$config['language']."/company_type_config.php");?>
            <tr  class="menu">
              <td align="left"><?php echo lang_show('protypes');?></td>
              <td><select class="select" name="trade_type" id="trade_type">
			   <?php 
			    $trade_type=explode('|',$module_product_config['trade_type']);
				foreach($trade_type as $key=>$v)
				{
				?>
                	<option value="<?php echo $key;?>"<?php if($types==$key) echo 'selected';?>><?php echo $v;?></option>
				<?php
				}
				?>
              </select>
			  </td>
            </tr>
            <tr> 
              <td align="left"><?php echo lang_show('price');?></td>
             <td width="823"> <input class="text" type="text" name="price" size="15" value="<?php echo "$price"; ?>"></td>
            </tr>
			<tr> 
              <td align="left"><?php echo lang_show('market_price');?></td>
             <td width="823"><input class="text" type="text" name="market_price" size="15" value="<?php echo "$market_price"; ?>"></td>
            </tr>
            <tr>
              <td align="left"><?php echo lang_show('keyword');?></td>
              <td><input class="text" name="keyword" type="text" value="<?php echo $keyword?>" size="30"></td>
            </tr>
			<tr>
              <td align="left"><?php echo lang_show('prosum');?></td>
              <td><textarea class="text" name="con" id="con" cols="45" rows="5"><?php echo strip_tags($con);?></textarea></td>
            </tr>
            <tr>  
              <td align="left"><?php echo lang_show('prodetail');?></td>
              <td>
			<?php
				$BasePath = "../lib/fckeditor/";
				include($BasePath."fckeditor.php");	
				$fck_en = new FCKeditor('prodetail') ;
				if($config['language']=='cn')
					$fck_en->Config['DefaultLanguage']='zh-cn';
				else
					$fck_en->Config['DefaultLanguage']='en';				
				$fck_en->BasePath    = $BasePath ;
				$fck_en->ToolbarSet  = 'Basic' ;
				$fck_en->Width='100%';
				$fck_en->Height=500;
				$fck_en->Config['ToolbarStartExpanded'] = true;
				$fck_en->Value = stripslashes($detail);
				echo $fck_en->CreateHtml();
			?>
			</td>
            </tr>
            <tr>
              <td align="left"><?php echo lang_show('competitive_ranking');?></td>
              <td align="left"><input class="text" name="rank" type="text" id="rank" value="<?php echo $rank?>" size="30"></td>
            </tr>
            <tr> 
              <td align="center">&nbsp;</td>
              <td align="left">
                <input name="cc1" class="btn" type="submit" id="cc1" value=" <?php echo lang_show('modify');?> ">
                <input name="action" type="hidden" id="action" value="submit"></td>
            </tr>
          </table>
      </form>
</div>
</div>

</body>
</html>